package com.cloud.consumer.mq;

import com.cloud.consumer.service.ReceiveService;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.context.annotation.Configuration;

import java.time.LocalDateTime;

/**
 * 注解方式绑定
 * 以ReceiveService作为参数，Spring容器启动时，会自动绑定ReceiveService接口定义的通道
 */
@Configuration
@EnableBinding(ReceiveService.class)
public class MQConfig {


    @StreamListener("myInput")
    public void receive(byte[] msg){
        System.out.println(LocalDateTime.now()+" groupA ----------Annotation receive msg： " +new String(msg));
    }

}
